 <?
        require_once('header.php'); // uri  
        ?>
    <link rel="stylesheet" href="css/createshelf.css">
    <script src="js/binaryajax.js"></script>
    <script src="js/exif.js"></script>
    <script src="js/canvasResize.js"></script>
    <script type="text/javascript" src="js/uploadbird.js"></script>
    <script type="text/javascript" src="js/jquery.validate.js"></script>
        <!--[if lt IE 7]>
            <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
        <![endif]-->
        
            <div class="wrpInnerBody">

                <?
        require_once('subheader.php'); // uri  
        ?>      

                <div class="wrpContent">
                    <div class="wrpInnerContent">
                        <?
                        require_once('headeradmin.php'); // uri  
                        
                        //$shelf=$this->data['editshelf']['shelf'];

                        ?>                   
                        <div class="wrapper">
                            <!--<form class="formCreateShelf" name="formCreateShelf" id="formCreateShelf"> -->
                                <div class="wrapCreateShelfandUser">
                                    <div class="wrapCreateShelf">
                                        <p class="textCreateShelf titleCreate"><?if($this->data['label']){ echo $this->data['label']; }else {?>Create <?}?> Shelf</p>
                                        <div class="wrapTmbnlShelf">
                                            <div id="droppic"><img id="imgshelf" class="upThumImg" src="<?if($this->data['editshelf']['shelf']['photo']){ echo imginfo."/".$this->data['editshelf']['shelf']['shelfid'].'/'.$this->data['editshelf']['shelf']['photo']; }else{?>img/thumnailshefdefault.jpg<?}?>" alt="upimage"></div>
                                            <p class="recommendThumShelf">300 x 300 px</p>
                                            <button class="btnBrowseTmbnl btnCreateS" id="shelfBtn" type="button">+ Image</button>
                                        </div>
                                        <div class="wrapTitleandDsctShelf">
                                            <input class="inptTitleShelf inptTitleDsct" id="title" name="title" value="<?=$this->data['editshelf']['shelf']['title']?>" type="text" placeholder="Title">
                                            <textarea class="inptDsctShelf inptTitleDsct" id="descritpion" name="descritpion" placeholder="Description" value=""><?=$this->data['editshelf']['shelf']['descritpion']?></textarea>
                                            <div class="wrapAddTag">
                                                  <p>Create tags</p>
                                                  <input type="text" class="inputTextTag" placeholder="+ Add tags here">
                                                  <input type="button" id="addTag" value="add" onchange="alert('tagsAdd_append()');"/>
                                                  <div class="wrapAddTagShow">
                                                        <div id="tagWrpShow">
                                                            <div id="tagsAdd" style="display:none;" class="wrpTagShow">
                                                                <button class="deleteTag">x</button>
                                                            </div>
                                                        </div>
                                                  </div>
                                            </div>
                                            <div class="wrapAddType">
                                                  <p>Create book types</p>
                                                  <input type="text" id="catnameadd" name="catnameadd" class="inputTextType" placeholder="+ Add tags here">
                                                  <input type="button" id="catAddBtn" value="add" onchange="alert('tagsAdd_append()');"/>
                                                  <div class="wrapAddTypeShow">
                                                        <div id="typeWrpShow">
                                                            <div id="typeAdd" style="display:none;" class="wrpTypeShow">
                                                                <button class="deleteType">x</button>
                                                            </div>
                                                        </div>
                                                  </div>
                                            </div>
                                        </div>
                                            <input type="hidden" value="<?=$this->data['editshelf']['shelf']['shelfid']?>" name="shelfid" id="shelfid" >
                                        </div>
                                       
                                        <div class="wrapAddSceenshot">
                                            <div class="addSlide">
                                                <div class="wrapScsDef">
                                                    <div class="wrapTumbnlDef">
                                                        <div class="upScsImg">
                                                            <div id="droppic1"><img id="imgbanner1" class="upScsImgA" src="<?if($this->data['editshelf']['banner'][0]['photo']){echo imginfo."/".$this->data['editshelf']['shelf']['shelfid'].'/banner/'.$this->data['editshelf']['banner'][0]['photo'];}else{?>img/banner.png<?}?>" alt="upimage">
                                                            <?if(!$this->data['editshelf']['banner'][0]['photo']){?>
                                                            <div class="upScsImgA">
                                                                <button class="btnAddScs btnAddB" id="bannerBtn1" type="button">+ Banner</button>
                                                            </div>
                                                            <?}?>
                                                            </div>
                                                            <div class="upScsImgA recSizeBar recBar">
                                                                <input class="inptLink" value="<?=$this->data['editshelf']['banner'][0]['link']?>" id="bannerLink-1" type="text" placeholder="Link">
                                                                <p class="recommendScsBook textUnderTumbnl">Recommended Size : 960 x 460 px</p>
                                                            </div>
                                                        </div>
                                                        <div class="upScsImg">
                                                          <div id="droppic2">
                                                            <img id="imgbanner2" class="upScsImgA" src="<?if($this->data['editshelf']['banner'][1]['photo']){echo imginfo."/".$this->data['editshelf']['shelf']['shelfid'].'/banner/'.$this->data['editshelf']['banner'][1]['photo'];}else{?>img/banner.png<?}?>" alt="upimage">
                                                            <?if(!$this->data['editshelf']['banner'][1]['photo']){?>
                                                            <div class="upScsImgA">
                                                                <button class="btnAddScs btnAddB" id="bannerBtn2" type="button">+ Banner</button>
                                                            </div>
                                                            <?}?>
                                                            </div>
                                                            <div class="upScsImgA recSizeBar recBar">
                                                                <input class="inptLink" id="bannerLink-2" value="<?=$this->data['editshelf']['banner'][1]['link']?>" type="text" placeholder="Link">
                                                                <p class="recommendScsBook textUnderTumbnl">Recommended Size : 960 x 460 px</p>
                                                            </div>
                                                        </div>
                                                        <div class="upScsImg">
                                                            <div id="droppic3">
                                                            <img id="imgbanner3" class="upScsImgA" src="<?if($this->data['editshelf']['banner'][2]['photo']){echo imginfo."/".$this->data['editshelf']['shelf']['shelfid'].'/banner/'.$this->data['editshelf']['banner'][2]['photo'];}else{?>img/banner.png<?}?>" alt="upimage">
                                                            <?if(!$this->data['editshelf']['banner'][2]['photo']){?>
                                                            <div class="upScsImgA">
                                                                <button class="btnAddScs btnAddB" id="bannerBtn3" type="button">+ Banner</button>
                                                            </div>
                                                            <?}?>
                                                            </div>
                                                            <div class="upScsImgA recSizeBar recBar">
                                                                <input class="inptLink" id="bannerLink-3" value="<?=$this->data['editshelf']['banner'][2]['link']?>" type="text" placeholder="Link">
                                                                <p class="recommendScsBook textUnderTumbnl">Recommended Size : 960 x 460 px</p>
                                                            </div>
                                                        </div>
                                                        <div class="upScsImg">
                                                        <div id="droppic4">
                                                            <img id="imgbanner4" class="upScsImgA" src="<?if($this->data['editshelf']['banner'][3]['photo']){echo imginfo."/".$this->data['editshelf']['shelf']['shelfid'].'/banner/'.$this->data['editshelf']['banner'][3]['photo'];}else{?>img/banner.png<?}?>" alt="upimage">
                                                            <?if(!$this->data['editshelf']['banner'][3]['photo']){?>
                                                            <div class="upScsImgA">
                                                                <button class="btnAddScs btnAddB" id="bannerBtn4" type="button">+ Banner</button>
                                                            </div>
                                                            <?}?>
                                                        </div>
                                                            <div class="upScsImgA recSizeBar recBar">
                                                                <input class="inptLink" id="bannerLink-4" value="<?=$this->data['editshelf']['banner'][3]['link']?>" type="text" placeholder="Link">
                                                                <p class="recommendScsBook textUnderTumbnl">Recommended Size : 960 x 460 px</p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="dotPage">
                                                <div class="dotOut dotP1 dotIn"></div>
                                                <div class="dotOut dotP2 "></div>
                                                <div class="dotOut dotP3 "></div>
                                                <div class="dotOut dotP4 "></div>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="wrapCreateUserandTable" style="min-height:250px">
                                        <p class="textCreateUser titleCreate">Create User</p>
                                        <!--<form class="userGroup" id="userGroup"> -->
                                        <div class="wrapCreateUser">
                                            <input class="inptNameUser inptUser" name="usernameadd" id="usernameadd" type="text" placeholder="Username">
                                            <input class="inptEmailUser inptUser" name="emailadd" id="emailadd" type="text" placeholder="Email">
                                            <input class="inptPwdUser inptUser"name="passwordadd" id="passwordadd" type="password" placeholder="Password">
                                            <button class="btnCreateUser btnCreateS" id="userAddBtn" type="button"  >+ User</button>
                                        </div>
                                        <!--</form> -->
                                       <!-- <form class="userGroup">   -->
                                            <table class="wrapTableUser" id="wrapTableUser">
                                               <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Username</th>
                                                    <th>Email</th>
                                                    <th>Password</th>
                                                   <!-- <th>Edit</th>-->
                                                    <th>Delete</th>
                                                </tr>
                                               </thead>
                                              <tbody>
                                              
                                              </tbody>  
                                            
                                                
                                            </table>
<!--                                        </form> -->
                                    </div>
                                

                                    <div class="wrapCreateUserandTable" style="min-height:150px">
                                        <p class="textCreateUser titleCreate" style="width: 120px;">Create Category</p>
                                        <!--<form class="userGroup" id="userGroup"> -->
                                        <div class="wrapCreateUser">
                                            <input class="inptNameUser inptUser" name="catnameadd" id="catnameadd" type="text" placeholder="Category">

                                            <button class="btnCreateUser btnCreateS" id="catAddBtn" type="button"  >+ Category</button>
                                        </div>
                                        <!--</form> -->
                                       <!-- <form class="userGroup">   -->
                                            <table class="wrapTableUser" id="wrapTableCat">
                                               <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Name</th>
                                                    <th>Delete</th>
                                                </tr>
                                               </thead>
                                              <tbody>
                                              
                                              </tbody>  
                                            
                                                
                                            </table>
<!--                                        </form> -->
                                    </div>

                                    <div class="wrapCreateUserandTable" style="min-height:150px">
                                        <p class="textCreateUser titleCreate" style="width: 120px;">Create Tag</p>
                                        <!--<form class="userGroup" id="userGroup"> -->
                                        <div class="wrapCreateUser">
                                            <input class="inptNameUser inptUser" name="tagnameadd" id="tagnameadd" type="text" placeholder="Tag">

                                            <button class="btnCreateUser btnCreateS" id="tagAddBtn" type="button"  >+ Tag</button>
                                        </div>
                                        <!--</form> -->
                                       <!-- <form class="userGroup">   -->
                                            <table class="wrapTableUser" id="wrapTableTag">
                                               <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Name</th>
                                                    <th>Delete</th>
                                                </tr>
                                               </thead>
                                              <tbody>
                                              
                                              </tbody>  
                                            
                                                
                                            </table>
<!--                                        </form> -->
                                    </div>
                                
                                
                                </div>
                                <div class="wrapBtnCreateShelf">
                                    <button class="btnCreateShelf btnCreateS" type="button" onclick="saveshelfbook()"><?if($this->data['label']){ echo $this->data['label']; }else {?>Create <?}?> Shelf</button>
                                </div>
                            <!--</form>-->
                        </div>
                    </div>
                </div>
            </div>

            <script type="text/javascript" src="js/createshelf.js"></script> 
            <?
            if($this->data['label']=="Edit")
            {
            ?>
            <script>
            $(function() {
            <?
            
            if(count($this->data['editshelf']['user'])){
            foreach($this->data['editshelf']['user'] as $valueuser){?>
            addUserByEdit('<?=$valueuser['userid']?>','<?=$valueuser['username']?>','<?=$valueuser['email']?>');
            <?
            }
            }
            
            
            if(count($this->data['editshelf']['cat'])){
            foreach($this->data['editshelf']['cat'] as $valuecat){?>
            addCatByEdit('<?=$valuecat['catid']?>','<?=$valuecat['name']?>');
            <?
            }
            }
            
            
            if(count($this->data['editshelf']['tag'])){
            foreach($this->data['editshelf']['tag'] as $valuetag){?>
            addTagByEdit('<?=$valuetag['tagid']?>','<?=$valuetag['name']?>');
            <?
            }
            }
            
            if($this->data['editshelf']['shelf']['photo'])
            {
            
            ?>
            $("#filebirdsavename-0").val('<?=$this->data['editshelf']['shelf']['photo']?>');
            <?
            
            }
             
              for($i=0;$i<4;$i++)
             {
              if($this->data['editshelf']['banner'][$i]['photo'])
             {?>
            $("#filebirdsavename-<?=($i+1)?>").val('<?=$this->data['editshelf']['banner'][$i]['photo']?>');
            
            
            <?}
              }
           
            ?>
            
            
            
            });
            </script>
           <?
              }
        require_once('footer.php'); // uri  
           ?>